﻿#ifndef ENABLESWITCHDELEGATE_H
#define ENABLESWITCHDELEGATE_H

#include <QStyledItemDelegate>
#include <QCheckBox>
#include <QStyleOption>
#include <QApplication>
#include <QMouseEvent>
#include <QPainter>
#include <QAbstractItemView>



class EnableSwitchDelegate :public QStyledItemDelegate
{
	Q_OBJECT

private:
	QPoint mousepos{};
signals:
	void enableswdeleData(bool enable, const QModelIndex& index);

public:
	EnableSwitchDelegate(QObject* parent = nullptr);

protected:
	void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override;
	bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index) override;

};


#endif // !ENABLESWITCHDELEGATE_H
